<?php


namespace App\Http\Service\api;


class BankAudit
{
    /**
     * @param $accountNo
     * @param $bankPreMobile
     * @param $idCardCode
     * @param $name
     * 银行卡审核
     */
     public static  function  bank($accountNo,$bankPreMobile,$idCardCode,$name){
         $host = "https://zball.market.alicloudapi.com";
         $path = "/v2/bcheck";
         $method = "POST";
         $appcode = "2520cba7f3cb4103b189aeffd32829ec";
         $headers = array();
         array_push($headers, "Authorization:APPCODE " . $appcode);
         //根据API的要求，定义相对应的Content-Type
         array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");
         $querys = "";
         $bodys = "accountNo=$accountNo&bankPreMobile=$bankPreMobile&idCardCode=$idCardCode&name=$name";
         $url = $host . $path;

         $curl = curl_init();
         curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
         curl_setopt($curl, CURLOPT_URL, $url);
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
         curl_setopt($curl, CURLOPT_FAILONERROR, false);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($curl, CURLOPT_HEADER, true);
         if (1 == strpos("$".$host, "https://"))
         {
             curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
             curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
         }
         curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);
         $res = curl_exec($curl);

         $start = strpos($res,'{');
         $end = strrpos($res,'}');
         $res = json_decode(substr($res,$start,$end),true);

         return $res;
     }
}
